 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
  <head> 
    <title>CuPlayer.com</title> 
    <meta http-equiv="pragma" content="no-cache"> 
    <meta http-equiv="cache-control" content="no-cache"> 
    <meta http-equiv="expires" content="0">     
    <meta http-equiv="keywords" content="CuPlayer.com,keyword2,keyword3"> 
    <meta http-equiv="description" content="This is my page"> 
    <meta charset="utf-8"> 
  </head> 
 
<body> 
    <div class="container"> 
        <input type="file" id="file" onchange="playMedia(5,10)">第5秒开始-10秒时暂停 
        <br > 
        <br > 
        <button onclick="setCurrentTime(7)" type="button">从第7秒开始播放</button> 
            
        <input type="text" id="showTime"/> 
        <br > 
        <br > 
        <video id="video1" autoplay="autoplay" controls > 
       
    <source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
    <source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm">
    <source src="http://vjs.zencdn.net/v/oceans.ogv" type="video/ogg">

        </video> 
         
    </div> 
 
</body> 
 
<script> 
 
    var myVid=document.getElementById("video1"); 
    myVid.addEventListener("timeupdate",timeupdate); 
 
    var _endTime; 
 
    //CuPlayer.com视频播放 
    function playMedia(startTime,endTime){ 
        //CuPlayer.com设置结束时间 
        _endTime = endTime; 
       var file = document.getElementById("file").files[0]; 
       if(!file){ 
        alert("请指定视频路径"); 
        return false; 
       } 
       var url = (window.URL) ? window.URL.createObjectURL(file) : window.webkitURL.createObjectURL(file); 
       myVid.src = url; 
       myVid.controls = true; 
       setTimeout("setCurrentTime('"+startTime+"')",200); 
    } 
 
    //CuPlayer.com设置视频开始播放事件 
    function setCurrentTime(startTime){ 
        myVid.currentTime=startTime; 
        myVid.play(); 
    } 
 
    function timeupdate(){ 
        //CuPlayer.com因为当前的格式是带毫秒的float类型的如：12.231233，所以把他转成String了便于后面分割取秒 
        var time = myVid.currentTime+""; 
        document.getElementById("showTime").value=time; 
        if(time>7){
        	myVid.pause(); 
        }
        var ts = time.substring(0,time.indexOf(".")); 
        if(ts==_endTime){ 
            myVid.pause(); 
        } 
    } 
 
</script> 
</html> 
 
 
 
  